<template>
  <div class="register-success">
    <div class="register-success-container">
      <div class="register-success-icon"></div>
      <div class="register-success-text">
        {{$t('message.submitIdentityConfirmSuccess')}}!
      </div>
      <div class="register-success-link">
        {{ time }}{{$t('message.jumpTo')}}<a href="/">{{$t('message.home')}}</a>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  name: 'RegisterSuccess',
  data () {
    return {
      totalTime: 3,
      time: 0
    }
  },
  methods: {
    toHome () {
      this.time = this.totalTime
      this.timeout = setInterval(() => {
        if (this.time > 0) {
          this.time--
        } else {
          this.$router.push({path: '/'})
        }
      }, 1000)
    }
  },
  mounted () {
    this.toHome()
  },
  deactivated () {
    clearTimeout(this.timeout)
  }
}
</script>

<style scoped>
.register-success {
  border: 1px solid transparent;
  margin-top: 100px;
}

.register-success-container {
  width: 226px;
  margin: 0 auto;
  position: relative;
}

.register-success-container  div {
  text-align: center;
}

.register-success-icon {
  margin: 0 auto;
  width: 60px;
  height: 60px;
  margin-bottom: 24px;
  background: url(../../assets/images/icon_success.png) no-repeat center center;
}

.register-success-text {
  margin: 0 auto;
  margin-bottom: 12px;
  font-size: 20px;
  color: #333333;
  letter-spacing: 1px;
}

.register-success-link {
  margin: 0 auto;
  margin-bottom: 100px;
  font-size: 14px;
  color: #747474;
}

.register-success-link a {
  color: #747474;
  text-decoration: underline;
}
</style>
